import  originData from "./lawyerData.json";
const allData = originData.map(item=>{
  return {
    id: item['序号'],
    name: item['姓名'],
    role: item['角色']?item['角色'].split('｜')[0]:'',
    desc: item['简介'],
    avatar: item['头像'] || '/static/image/login-background.jpeg',
    tel: item['电话'],
    email: item['邮箱'],
    address: item['地址'],
    eduBackground: item['教育背景'],
    societyRoles: item['社会关系与任职']?item['社会关系与任职'].split('｜'):[],
    honors: item['荣誉与评价']?item['荣誉与评价'].split('｜'):[],
    professionalResearchs: item['专业研究']?item['专业研究'].split('｜'):[],
    bankruptcyReorganization: item['破产重整及清算项目']?item['破产重整及清算项目'].split('｜'):[],
    bankruptcyDerivative: item['破产衍生专项法律服务']?item['破产衍生专项法律服务'].split('｜'):[],
    legalCounsel: item['法律顾问']?item['法律顾问'].split('｜'):[],
    otherAchievements: item['其他业绩']?item['其他业绩'].split('｜'):[],
    litigationLegalServices: item['部分典型诉讼法律服务']?item['部分典型诉讼法律服务'].split('｜'):[],
  }
})

export function getLawyerList(params){
 const keyword = params?.keyword
 let lawyerList = allData;
 if(keyword){
  lawyerList = lawyerList.filter(item=>item.name.includes(keyword))
 }
 return lawyerList;
}

export function getLawyerDetail(id){
let item:any= allData.find(item=>item.id===id)||{}
return item
}
